﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using MsTestUtilities.RowTests;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MsTestUtilitiesTests.RowTests.ExpectorTests
{
    internal static class ExpectationAssert
    {
        public static void IsValidFor<T>(Func<T> action, IExpectation<T> expectation)
        {
            Assert.IsTrue(GetAssertionResult(action, expectation));
        }

        public static void FailsFor<T>(Func<T> action, IExpectation<T> expectation)
        {
            Assert.IsFalse(GetAssertionResult(action, expectation));
        }

        private static bool GetAssertionResult<T>(Func<T> action, IExpectation<T> expectation)        
        {
            return expectation.IsSatisfiedFor(action).AssertionHolds;
        }
    }
}
